﻿package com.controller;

import java.io.File;
import java.io.IOException;

import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.io.PrintWriter;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartFile;

import com.entity.Xuanzejiajiao;
import com.server.XuanzejiajiaoServer;
import com.util.PageBean;
import net.sf.json.JSONObject;
import com.util.db;
import java.sql.SQLException;
import java.sql.*;
@Controller
public class XuanzejiajiaoController {
	@Resource
	private XuanzejiajiaoServer xuanzejiajiaoService;


   
	@RequestMapping("addXuanzejiajiao.do")
	public String addXuanzejiajiao(HttpServletRequest request,Xuanzejiajiao xuanzejiajiao,HttpSession session) throws SQLException{
		Timestamp time=new Timestamp(System.currentTimeMillis());
		
		xuanzejiajiao.setAddtime(time.toString().substring(0, 19));
		xuanzejiajiaoService.add(xuanzejiajiao);
		
		session.setAttribute("backxx", "添加成功");
		session.setAttribute("backurl", request.getHeader("Referer"));
		
		//session.setAttribute("backurl", "xuanzejiajiaoList.do");
		
		return "redirect:postback.jsp";
		//return "redirect:xuanzejiajiaoList.do";
		
		
		
	}
 
//	处理编辑
	@RequestMapping("doUpdateXuanzejiajiao.do")
	public String doUpdateXuanzejiajiao(int id,ModelMap map,Xuanzejiajiao xuanzejiajiao){
		xuanzejiajiao=xuanzejiajiaoService.getById(id);
		map.put("xuanzejiajiao", xuanzejiajiao);
		return "xuanzejiajiao_updt";
	}
	
	
	
	
	
//	后台详细
	@RequestMapping("xuanzejiajiaoDetail.do")
	public String xuanzejiajiaoDetail(int id,ModelMap map,Xuanzejiajiao xuanzejiajiao){
		xuanzejiajiao=xuanzejiajiaoService.getById(id);
		map.put("xuanzejiajiao", xuanzejiajiao);
		return "xuanzejiajiao_detail";
	}
//	前台详细
	@RequestMapping("xzjjDetail.do")
	public String xzjjDetail(int id,ModelMap map,Xuanzejiajiao xuanzejiajiao){
		xuanzejiajiao=xuanzejiajiaoService.getById(id);
		map.put("xuanzejiajiao", xuanzejiajiao);
		return "xuanzejiajiaodetail";
	}
//	
	@RequestMapping("updateXuanzejiajiao.do")
	public String updateXuanzejiajiao(int id,ModelMap map,Xuanzejiajiao xuanzejiajiao,HttpServletRequest request,HttpSession session){
		xuanzejiajiaoService.update(xuanzejiajiao);
		session.setAttribute("backxx", "修改成功");
		session.setAttribute("backurl", request.getHeader("Referer"));
		return "redirect:postback.jsp";
		//String url = request.getHeader("Referer");
		//return "redirect:"+url;
		//return "redirect:xuanzejiajiaoList.do";
	}

//	分页查询
	@RequestMapping("xuanzejiajiaoList.do")
	public String xuanzejiajiaoList(@RequestParam(value="page",required=false)String page,
			ModelMap map,HttpSession session,Xuanzejiajiao xuanzejiajiao, String dingdanhao, String jiaoshixingming, String zhujiaokecheng, String jiaoling, String xueli, String lianxidianhua, String feiyong, String goumaikeshishuliang1,String goumaikeshishuliang2, String jine, String yonghuming, String xingming, String shoujihao, String beizhu){
		if(page==null||page.equals("")){
			page="1";
		}
		PageBean pageBean=new PageBean(Integer.parseInt(page), 15);
		Map<String, Object> pmap=new HashMap<String,Object>();
		pmap.put("pageno", pageBean.getStart());
		pmap.put("pageSize", 15);
		
		
		if(dingdanhao==null||dingdanhao.equals("")){pmap.put("dingdanhao", null);}else{pmap.put("dingdanhao", dingdanhao);}		if(jiaoshixingming==null||jiaoshixingming.equals("")){pmap.put("jiaoshixingming", null);}else{pmap.put("jiaoshixingming", jiaoshixingming);}		if(zhujiaokecheng==null||zhujiaokecheng.equals("")){pmap.put("zhujiaokecheng", null);}else{pmap.put("zhujiaokecheng", zhujiaokecheng);}		if(jiaoling==null||jiaoling.equals("")){pmap.put("jiaoling", null);}else{pmap.put("jiaoling", jiaoling);}		if(xueli==null||xueli.equals("")){pmap.put("xueli", null);}else{pmap.put("xueli", xueli);}		if(lianxidianhua==null||lianxidianhua.equals("")){pmap.put("lianxidianhua", null);}else{pmap.put("lianxidianhua", lianxidianhua);}		if(feiyong==null||feiyong.equals("")){pmap.put("feiyong", null);}else{pmap.put("feiyong", feiyong);}		if(goumaikeshishuliang1==null||goumaikeshishuliang1.equals("")){pmap.put("goumaikeshishuliang1", null);}else{pmap.put("goumaikeshishuliang1", goumaikeshishuliang1);}		if(goumaikeshishuliang2==null||goumaikeshishuliang2.equals("")){pmap.put("goumaikeshishuliang2", null);}else{pmap.put("goumaikeshishuliang2", goumaikeshishuliang2);}		if(jine==null||jine.equals("")){pmap.put("jine", null);}else{pmap.put("jine", jine);}		if(yonghuming==null||yonghuming.equals("")){pmap.put("yonghuming", null);}else{pmap.put("yonghuming", yonghuming);}		if(xingming==null||xingming.equals("")){pmap.put("xingming", null);}else{pmap.put("xingming", xingming);}		if(shoujihao==null||shoujihao.equals("")){pmap.put("shoujihao", null);}else{pmap.put("shoujihao", shoujihao);}		if(beizhu==null||beizhu.equals("")){pmap.put("beizhu", null);}else{pmap.put("beizhu", beizhu);}		
		int total=xuanzejiajiaoService.getCount(pmap);
		pageBean.setTotal(total);
		List<Xuanzejiajiao> list=xuanzejiajiaoService.getByPage(pmap);
		map.put("page", pageBean);
		map.put("list", list);
		session.setAttribute("p", 1);
		return "xuanzejiajiao_list";
	}
	
	@RequestMapping("xuanzejiajiao_yanben1.do")
	public String xuanzejiajiao_yanben1(@RequestParam(value="page",required=false)String page,
			ModelMap map,HttpSession session,Xuanzejiajiao xuanzejiajiao, String dingdanhao, String jiaoshixingming, String zhujiaokecheng, String jiaoling, String xueli, String lianxidianhua, String feiyong, String goumaikeshishuliang1,String goumaikeshishuliang2, String jine, String yonghuming, String xingming, String shoujihao, String beizhu){
		if(page==null||page.equals("")){
			page="1";
		}
		PageBean pageBean=new PageBean(Integer.parseInt(page), 15);
		Map<String, Object> pmap=new HashMap<String,Object>();
		pmap.put("pageno", pageBean.getStart());
		pmap.put("pageSize", 15);
		
		
		if(dingdanhao==null||dingdanhao.equals("")){pmap.put("dingdanhao", null);}else{pmap.put("dingdanhao", dingdanhao);}		if(jiaoshixingming==null||jiaoshixingming.equals("")){pmap.put("jiaoshixingming", null);}else{pmap.put("jiaoshixingming", jiaoshixingming);}		if(zhujiaokecheng==null||zhujiaokecheng.equals("")){pmap.put("zhujiaokecheng", null);}else{pmap.put("zhujiaokecheng", zhujiaokecheng);}		if(jiaoling==null||jiaoling.equals("")){pmap.put("jiaoling", null);}else{pmap.put("jiaoling", jiaoling);}		if(xueli==null||xueli.equals("")){pmap.put("xueli", null);}else{pmap.put("xueli", xueli);}		if(lianxidianhua==null||lianxidianhua.equals("")){pmap.put("lianxidianhua", null);}else{pmap.put("lianxidianhua", lianxidianhua);}		if(feiyong==null||feiyong.equals("")){pmap.put("feiyong", null);}else{pmap.put("feiyong", feiyong);}		if(goumaikeshishuliang1==null||goumaikeshishuliang1.equals("")){pmap.put("goumaikeshishuliang1", null);}else{pmap.put("goumaikeshishuliang1", goumaikeshishuliang1);}		if(goumaikeshishuliang2==null||goumaikeshishuliang2.equals("")){pmap.put("goumaikeshishuliang2", null);}else{pmap.put("goumaikeshishuliang2", goumaikeshishuliang2);}		if(jine==null||jine.equals("")){pmap.put("jine", null);}else{pmap.put("jine", jine);}		if(yonghuming==null||yonghuming.equals("")){pmap.put("yonghuming", null);}else{pmap.put("yonghuming", yonghuming);}		if(xingming==null||xingming.equals("")){pmap.put("xingming", null);}else{pmap.put("xingming", xingming);}		if(shoujihao==null||shoujihao.equals("")){pmap.put("shoujihao", null);}else{pmap.put("shoujihao", shoujihao);}		if(beizhu==null||beizhu.equals("")){pmap.put("beizhu", null);}else{pmap.put("beizhu", beizhu);}		
		int total=xuanzejiajiaoService.getCount(pmap);
		pageBean.setTotal(total);
		List<Xuanzejiajiao> list=xuanzejiajiaoService.getByPage(pmap);
		map.put("page", pageBean);
		map.put("list", list);
		session.setAttribute("p", 1);
		return "xuanzejiajiao_yanben1";
	}
	@RequestMapping("xuanzejiajiao_yanben2.do")
	public String xuanzejiajiao_yanben2(@RequestParam(value="page",required=false)String page,
			ModelMap map,HttpSession session,Xuanzejiajiao xuanzejiajiao, String dingdanhao, String jiaoshixingming, String zhujiaokecheng, String jiaoling, String xueli, String lianxidianhua, String feiyong, String goumaikeshishuliang1,String goumaikeshishuliang2, String jine, String yonghuming, String xingming, String shoujihao, String beizhu){
		if(page==null||page.equals("")){
			page="1";
		}
		PageBean pageBean=new PageBean(Integer.parseInt(page), 15);
		Map<String, Object> pmap=new HashMap<String,Object>();
		pmap.put("pageno", pageBean.getStart());
		pmap.put("pageSize", 15);
		
		
		if(dingdanhao==null||dingdanhao.equals("")){pmap.put("dingdanhao", null);}else{pmap.put("dingdanhao", dingdanhao);}		if(jiaoshixingming==null||jiaoshixingming.equals("")){pmap.put("jiaoshixingming", null);}else{pmap.put("jiaoshixingming", jiaoshixingming);}		if(zhujiaokecheng==null||zhujiaokecheng.equals("")){pmap.put("zhujiaokecheng", null);}else{pmap.put("zhujiaokecheng", zhujiaokecheng);}		if(jiaoling==null||jiaoling.equals("")){pmap.put("jiaoling", null);}else{pmap.put("jiaoling", jiaoling);}		if(xueli==null||xueli.equals("")){pmap.put("xueli", null);}else{pmap.put("xueli", xueli);}		if(lianxidianhua==null||lianxidianhua.equals("")){pmap.put("lianxidianhua", null);}else{pmap.put("lianxidianhua", lianxidianhua);}		if(feiyong==null||feiyong.equals("")){pmap.put("feiyong", null);}else{pmap.put("feiyong", feiyong);}		if(goumaikeshishuliang1==null||goumaikeshishuliang1.equals("")){pmap.put("goumaikeshishuliang1", null);}else{pmap.put("goumaikeshishuliang1", goumaikeshishuliang1);}		if(goumaikeshishuliang2==null||goumaikeshishuliang2.equals("")){pmap.put("goumaikeshishuliang2", null);}else{pmap.put("goumaikeshishuliang2", goumaikeshishuliang2);}		if(jine==null||jine.equals("")){pmap.put("jine", null);}else{pmap.put("jine", jine);}		if(yonghuming==null||yonghuming.equals("")){pmap.put("yonghuming", null);}else{pmap.put("yonghuming", yonghuming);}		if(xingming==null||xingming.equals("")){pmap.put("xingming", null);}else{pmap.put("xingming", xingming);}		if(shoujihao==null||shoujihao.equals("")){pmap.put("shoujihao", null);}else{pmap.put("shoujihao", shoujihao);}		if(beizhu==null||beizhu.equals("")){pmap.put("beizhu", null);}else{pmap.put("beizhu", beizhu);}		
		int total=xuanzejiajiaoService.getCount(pmap);
		pageBean.setTotal(total);
		List<Xuanzejiajiao> list=xuanzejiajiaoService.getByPage(pmap);
		map.put("page", pageBean);
		map.put("list", list);
		session.setAttribute("p", 1);
		return "xuanzejiajiao_yanben2";
	}
	@RequestMapping("xuanzejiajiao_yanben3.do")
	public String xuanzejiajiao_yanben3(@RequestParam(value="page",required=false)String page,
			ModelMap map,HttpSession session,Xuanzejiajiao xuanzejiajiao, String dingdanhao, String jiaoshixingming, String zhujiaokecheng, String jiaoling, String xueli, String lianxidianhua, String feiyong, String goumaikeshishuliang1,String goumaikeshishuliang2, String jine, String yonghuming, String xingming, String shoujihao, String beizhu){
		if(page==null||page.equals("")){
			page="1";
		}
		PageBean pageBean=new PageBean(Integer.parseInt(page), 15);
		Map<String, Object> pmap=new HashMap<String,Object>();
		pmap.put("pageno", pageBean.getStart());
		pmap.put("pageSize", 15);
		
		
		if(dingdanhao==null||dingdanhao.equals("")){pmap.put("dingdanhao", null);}else{pmap.put("dingdanhao", dingdanhao);}		if(jiaoshixingming==null||jiaoshixingming.equals("")){pmap.put("jiaoshixingming", null);}else{pmap.put("jiaoshixingming", jiaoshixingming);}		if(zhujiaokecheng==null||zhujiaokecheng.equals("")){pmap.put("zhujiaokecheng", null);}else{pmap.put("zhujiaokecheng", zhujiaokecheng);}		if(jiaoling==null||jiaoling.equals("")){pmap.put("jiaoling", null);}else{pmap.put("jiaoling", jiaoling);}		if(xueli==null||xueli.equals("")){pmap.put("xueli", null);}else{pmap.put("xueli", xueli);}		if(lianxidianhua==null||lianxidianhua.equals("")){pmap.put("lianxidianhua", null);}else{pmap.put("lianxidianhua", lianxidianhua);}		if(feiyong==null||feiyong.equals("")){pmap.put("feiyong", null);}else{pmap.put("feiyong", feiyong);}		if(goumaikeshishuliang1==null||goumaikeshishuliang1.equals("")){pmap.put("goumaikeshishuliang1", null);}else{pmap.put("goumaikeshishuliang1", goumaikeshishuliang1);}		if(goumaikeshishuliang2==null||goumaikeshishuliang2.equals("")){pmap.put("goumaikeshishuliang2", null);}else{pmap.put("goumaikeshishuliang2", goumaikeshishuliang2);}		if(jine==null||jine.equals("")){pmap.put("jine", null);}else{pmap.put("jine", jine);}		if(yonghuming==null||yonghuming.equals("")){pmap.put("yonghuming", null);}else{pmap.put("yonghuming", yonghuming);}		if(xingming==null||xingming.equals("")){pmap.put("xingming", null);}else{pmap.put("xingming", xingming);}		if(shoujihao==null||shoujihao.equals("")){pmap.put("shoujihao", null);}else{pmap.put("shoujihao", shoujihao);}		if(beizhu==null||beizhu.equals("")){pmap.put("beizhu", null);}else{pmap.put("beizhu", beizhu);}		
		int total=xuanzejiajiaoService.getCount(pmap);
		pageBean.setTotal(total);
		List<Xuanzejiajiao> list=xuanzejiajiaoService.getByPage(pmap);
		map.put("page", pageBean);
		map.put("list", list);
		session.setAttribute("p", 1);
		return "xuanzejiajiao_yanben3";
	}
	@RequestMapping("xuanzejiajiao_yanben4.do")
	public String xuanzejiajiao_yanben4(@RequestParam(value="page",required=false)String page,
			ModelMap map,HttpSession session,Xuanzejiajiao xuanzejiajiao, String dingdanhao, String jiaoshixingming, String zhujiaokecheng, String jiaoling, String xueli, String lianxidianhua, String feiyong, String goumaikeshishuliang1,String goumaikeshishuliang2, String jine, String yonghuming, String xingming, String shoujihao, String beizhu){
		if(page==null||page.equals("")){
			page="1";
		}
		PageBean pageBean=new PageBean(Integer.parseInt(page), 15);
		Map<String, Object> pmap=new HashMap<String,Object>();
		pmap.put("pageno", pageBean.getStart());
		pmap.put("pageSize", 15);
		
		
		if(dingdanhao==null||dingdanhao.equals("")){pmap.put("dingdanhao", null);}else{pmap.put("dingdanhao", dingdanhao);}		if(jiaoshixingming==null||jiaoshixingming.equals("")){pmap.put("jiaoshixingming", null);}else{pmap.put("jiaoshixingming", jiaoshixingming);}		if(zhujiaokecheng==null||zhujiaokecheng.equals("")){pmap.put("zhujiaokecheng", null);}else{pmap.put("zhujiaokecheng", zhujiaokecheng);}		if(jiaoling==null||jiaoling.equals("")){pmap.put("jiaoling", null);}else{pmap.put("jiaoling", jiaoling);}		if(xueli==null||xueli.equals("")){pmap.put("xueli", null);}else{pmap.put("xueli", xueli);}		if(lianxidianhua==null||lianxidianhua.equals("")){pmap.put("lianxidianhua", null);}else{pmap.put("lianxidianhua", lianxidianhua);}		if(feiyong==null||feiyong.equals("")){pmap.put("feiyong", null);}else{pmap.put("feiyong", feiyong);}		if(goumaikeshishuliang1==null||goumaikeshishuliang1.equals("")){pmap.put("goumaikeshishuliang1", null);}else{pmap.put("goumaikeshishuliang1", goumaikeshishuliang1);}		if(goumaikeshishuliang2==null||goumaikeshishuliang2.equals("")){pmap.put("goumaikeshishuliang2", null);}else{pmap.put("goumaikeshishuliang2", goumaikeshishuliang2);}		if(jine==null||jine.equals("")){pmap.put("jine", null);}else{pmap.put("jine", jine);}		if(yonghuming==null||yonghuming.equals("")){pmap.put("yonghuming", null);}else{pmap.put("yonghuming", yonghuming);}		if(xingming==null||xingming.equals("")){pmap.put("xingming", null);}else{pmap.put("xingming", xingming);}		if(shoujihao==null||shoujihao.equals("")){pmap.put("shoujihao", null);}else{pmap.put("shoujihao", shoujihao);}		if(beizhu==null||beizhu.equals("")){pmap.put("beizhu", null);}else{pmap.put("beizhu", beizhu);}		
		int total=xuanzejiajiaoService.getCount(pmap);
		pageBean.setTotal(total);
		List<Xuanzejiajiao> list=xuanzejiajiaoService.getByPage(pmap);
		map.put("page", pageBean);
		map.put("list", list);
		session.setAttribute("p", 1);
		return "xuanzejiajiao_yanben4";
	}
	@RequestMapping("xuanzejiajiao_yanben5.do")
	public String xuanzejiajiao_yanben5(@RequestParam(value="page",required=false)String page,
			ModelMap map,HttpSession session,Xuanzejiajiao xuanzejiajiao, String dingdanhao, String jiaoshixingming, String zhujiaokecheng, String jiaoling, String xueli, String lianxidianhua, String feiyong, String goumaikeshishuliang1,String goumaikeshishuliang2, String jine, String yonghuming, String xingming, String shoujihao, String beizhu){
		if(page==null||page.equals("")){
			page="1";
		}
		PageBean pageBean=new PageBean(Integer.parseInt(page), 15);
		Map<String, Object> pmap=new HashMap<String,Object>();
		pmap.put("pageno", pageBean.getStart());
		pmap.put("pageSize", 15);
		
		
		if(dingdanhao==null||dingdanhao.equals("")){pmap.put("dingdanhao", null);}else{pmap.put("dingdanhao", dingdanhao);}		if(jiaoshixingming==null||jiaoshixingming.equals("")){pmap.put("jiaoshixingming", null);}else{pmap.put("jiaoshixingming", jiaoshixingming);}		if(zhujiaokecheng==null||zhujiaokecheng.equals("")){pmap.put("zhujiaokecheng", null);}else{pmap.put("zhujiaokecheng", zhujiaokecheng);}		if(jiaoling==null||jiaoling.equals("")){pmap.put("jiaoling", null);}else{pmap.put("jiaoling", jiaoling);}		if(xueli==null||xueli.equals("")){pmap.put("xueli", null);}else{pmap.put("xueli", xueli);}		if(lianxidianhua==null||lianxidianhua.equals("")){pmap.put("lianxidianhua", null);}else{pmap.put("lianxidianhua", lianxidianhua);}		if(feiyong==null||feiyong.equals("")){pmap.put("feiyong", null);}else{pmap.put("feiyong", feiyong);}		if(goumaikeshishuliang1==null||goumaikeshishuliang1.equals("")){pmap.put("goumaikeshishuliang1", null);}else{pmap.put("goumaikeshishuliang1", goumaikeshishuliang1);}		if(goumaikeshishuliang2==null||goumaikeshishuliang2.equals("")){pmap.put("goumaikeshishuliang2", null);}else{pmap.put("goumaikeshishuliang2", goumaikeshishuliang2);}		if(jine==null||jine.equals("")){pmap.put("jine", null);}else{pmap.put("jine", jine);}		if(yonghuming==null||yonghuming.equals("")){pmap.put("yonghuming", null);}else{pmap.put("yonghuming", yonghuming);}		if(xingming==null||xingming.equals("")){pmap.put("xingming", null);}else{pmap.put("xingming", xingming);}		if(shoujihao==null||shoujihao.equals("")){pmap.put("shoujihao", null);}else{pmap.put("shoujihao", shoujihao);}		if(beizhu==null||beizhu.equals("")){pmap.put("beizhu", null);}else{pmap.put("beizhu", beizhu);}		
		int total=xuanzejiajiaoService.getCount(pmap);
		pageBean.setTotal(total);
		List<Xuanzejiajiao> list=xuanzejiajiaoService.getByPage(pmap);
		map.put("page", pageBean);
		map.put("list", list);
		session.setAttribute("p", 1);
		return "xuanzejiajiao_yanben5";
	}
	
	@RequestMapping("xuanzejiajiaoList2.do")
	public String xuanzejiajiaoList2(@RequestParam(value="page",required=false)String page,
			ModelMap map,HttpSession session,Xuanzejiajiao xuanzejiajiao, String dingdanhao, String jiaoshixingming, String zhujiaokecheng, String jiaoling, String xueli, String lianxidianhua, String feiyong, String goumaikeshishuliang1,String goumaikeshishuliang2, String jine, String yonghuming, String xingming, String shoujihao, String beizhu,HttpServletRequest request){
		/*if(session.getAttribute("user")==null){
			return "login";
		}*/
		if(page==null||page.equals("")){
			page="1";
		}
		PageBean pageBean=new PageBean(Integer.parseInt(page), 15);
		Map<String, Object> pmap=new HashMap<String,Object>();
		pmap.put("pageno", pageBean.getStart());
		pmap.put("pageSize", 15);
		
		pmap.put("yonghuming", (String)request.getSession().getAttribute("username"));
		if(dingdanhao==null||dingdanhao.equals("")){pmap.put("dingdanhao", null);}else{pmap.put("dingdanhao", dingdanhao);}		if(jiaoshixingming==null||jiaoshixingming.equals("")){pmap.put("jiaoshixingming", null);}else{pmap.put("jiaoshixingming", jiaoshixingming);}		if(zhujiaokecheng==null||zhujiaokecheng.equals("")){pmap.put("zhujiaokecheng", null);}else{pmap.put("zhujiaokecheng", zhujiaokecheng);}		if(jiaoling==null||jiaoling.equals("")){pmap.put("jiaoling", null);}else{pmap.put("jiaoling", jiaoling);}		if(xueli==null||xueli.equals("")){pmap.put("xueli", null);}else{pmap.put("xueli", xueli);}		if(lianxidianhua==null||lianxidianhua.equals("")){pmap.put("lianxidianhua", null);}else{pmap.put("lianxidianhua", lianxidianhua);}		if(feiyong==null||feiyong.equals("")){pmap.put("feiyong", null);}else{pmap.put("feiyong", feiyong);}		if(goumaikeshishuliang1==null||goumaikeshishuliang1.equals("")){pmap.put("goumaikeshishuliang1", null);}else{pmap.put("goumaikeshishuliang1", goumaikeshishuliang1);}		if(goumaikeshishuliang2==null||goumaikeshishuliang2.equals("")){pmap.put("goumaikeshishuliang2", null);}else{pmap.put("goumaikeshishuliang2", goumaikeshishuliang2);}		if(jine==null||jine.equals("")){pmap.put("jine", null);}else{pmap.put("jine", jine);}		if(xingming==null||xingming.equals("")){pmap.put("xingming", null);}else{pmap.put("xingming", xingming);}		if(shoujihao==null||shoujihao.equals("")){pmap.put("shoujihao", null);}else{pmap.put("shoujihao", shoujihao);}		if(beizhu==null||beizhu.equals("")){pmap.put("beizhu", null);}else{pmap.put("beizhu", beizhu);}		
		
		int total=xuanzejiajiaoService.getCount(pmap);
		pageBean.setTotal(total);
		List<Xuanzejiajiao> list=xuanzejiajiaoService.getByPage(pmap);
		map.put("page", pageBean);
		map.put("list", list);
		session.setAttribute("p", 1);
		return "xuanzejiajiao_list2";
	}	
	
	@RequestMapping("xzjjList.do")
	public String xzjjList(@RequestParam(value="page",required=false)String page,
			ModelMap map,HttpSession session,Xuanzejiajiao xuanzejiajiao, String dingdanhao, String jiaoshixingming, String zhujiaokecheng, String jiaoling, String xueli, String lianxidianhua, String feiyong, String goumaikeshishuliang1,String goumaikeshishuliang2, String jine, String yonghuming, String xingming, String shoujihao, String beizhu){
		if(page==null||page.equals("")){
			page="1";
		}
		PageBean pageBean=new PageBean(Integer.parseInt(page), 15);
		Map<String, Object> pmap=new HashMap<String,Object>();
		pmap.put("pageno", pageBean.getStart());
		pmap.put("pageSize", 15);
		
		
		if(dingdanhao==null||dingdanhao.equals("")){pmap.put("dingdanhao", null);}else{pmap.put("dingdanhao", dingdanhao);}		if(jiaoshixingming==null||jiaoshixingming.equals("")){pmap.put("jiaoshixingming", null);}else{pmap.put("jiaoshixingming", jiaoshixingming);}		if(zhujiaokecheng==null||zhujiaokecheng.equals("")){pmap.put("zhujiaokecheng", null);}else{pmap.put("zhujiaokecheng", zhujiaokecheng);}		if(jiaoling==null||jiaoling.equals("")){pmap.put("jiaoling", null);}else{pmap.put("jiaoling", jiaoling);}		if(xueli==null||xueli.equals("")){pmap.put("xueli", null);}else{pmap.put("xueli", xueli);}		if(lianxidianhua==null||lianxidianhua.equals("")){pmap.put("lianxidianhua", null);}else{pmap.put("lianxidianhua", lianxidianhua);}		if(feiyong==null||feiyong.equals("")){pmap.put("feiyong", null);}else{pmap.put("feiyong", feiyong);}		if(goumaikeshishuliang1==null||goumaikeshishuliang1.equals("")){pmap.put("goumaikeshishuliang1", null);}else{pmap.put("goumaikeshishuliang1", goumaikeshishuliang1);}		if(goumaikeshishuliang2==null||goumaikeshishuliang2.equals("")){pmap.put("goumaikeshishuliang2", null);}else{pmap.put("goumaikeshishuliang2", goumaikeshishuliang2);}		if(jine==null||jine.equals("")){pmap.put("jine", null);}else{pmap.put("jine", jine);}		if(yonghuming==null||yonghuming.equals("")){pmap.put("yonghuming", null);}else{pmap.put("yonghuming", yonghuming);}		if(xingming==null||xingming.equals("")){pmap.put("xingming", null);}else{pmap.put("xingming", xingming);}		if(shoujihao==null||shoujihao.equals("")){pmap.put("shoujihao", null);}else{pmap.put("shoujihao", shoujihao);}		if(beizhu==null||beizhu.equals("")){pmap.put("beizhu", null);}else{pmap.put("beizhu", beizhu);}		
		int total=xuanzejiajiaoService.getCount(pmap);
		pageBean.setTotal(total);
		List<Xuanzejiajiao> list=xuanzejiajiaoService.getByPage(pmap);
		map.put("page", pageBean);
		map.put("list", list);
		session.setAttribute("p", 1);
		return "xuanzejiajiaolist";
	}
	@RequestMapping("xzjjListtp.do")
	public String xzjjListtp(@RequestParam(value="page",required=false)String page,
			ModelMap map,HttpSession session,Xuanzejiajiao xuanzejiajiao, String dingdanhao, String jiaoshixingming, String zhujiaokecheng, String jiaoling, String xueli, String lianxidianhua, String feiyong, String goumaikeshishuliang1,String goumaikeshishuliang2, String jine, String yonghuming, String xingming, String shoujihao, String beizhu){
		if(page==null||page.equals("")){
			page="1";
		}
		PageBean pageBean=new PageBean(Integer.parseInt(page), 15);
		Map<String, Object> pmap=new HashMap<String,Object>();
		pmap.put("pageno", pageBean.getStart());
		pmap.put("pageSize", 15);
		
		
		if(dingdanhao==null||dingdanhao.equals("")){pmap.put("dingdanhao", null);}else{pmap.put("dingdanhao", dingdanhao);}		if(jiaoshixingming==null||jiaoshixingming.equals("")){pmap.put("jiaoshixingming", null);}else{pmap.put("jiaoshixingming", jiaoshixingming);}		if(zhujiaokecheng==null||zhujiaokecheng.equals("")){pmap.put("zhujiaokecheng", null);}else{pmap.put("zhujiaokecheng", zhujiaokecheng);}		if(jiaoling==null||jiaoling.equals("")){pmap.put("jiaoling", null);}else{pmap.put("jiaoling", jiaoling);}		if(xueli==null||xueli.equals("")){pmap.put("xueli", null);}else{pmap.put("xueli", xueli);}		if(lianxidianhua==null||lianxidianhua.equals("")){pmap.put("lianxidianhua", null);}else{pmap.put("lianxidianhua", lianxidianhua);}		if(feiyong==null||feiyong.equals("")){pmap.put("feiyong", null);}else{pmap.put("feiyong", feiyong);}		if(goumaikeshishuliang1==null||goumaikeshishuliang1.equals("")){pmap.put("goumaikeshishuliang1", null);}else{pmap.put("goumaikeshishuliang1", goumaikeshishuliang1);}		if(goumaikeshishuliang2==null||goumaikeshishuliang2.equals("")){pmap.put("goumaikeshishuliang2", null);}else{pmap.put("goumaikeshishuliang2", goumaikeshishuliang2);}		if(jine==null||jine.equals("")){pmap.put("jine", null);}else{pmap.put("jine", jine);}		if(yonghuming==null||yonghuming.equals("")){pmap.put("yonghuming", null);}else{pmap.put("yonghuming", yonghuming);}		if(xingming==null||xingming.equals("")){pmap.put("xingming", null);}else{pmap.put("xingming", xingming);}		if(shoujihao==null||shoujihao.equals("")){pmap.put("shoujihao", null);}else{pmap.put("shoujihao", shoujihao);}		if(beizhu==null||beizhu.equals("")){pmap.put("beizhu", null);}else{pmap.put("beizhu", beizhu);}		
		int total=xuanzejiajiaoService.getCount(pmap);
		pageBean.setTotal(total);
		List<Xuanzejiajiao> list=xuanzejiajiaoService.getByPage(pmap);
		map.put("page", pageBean);
		map.put("list", list);
		session.setAttribute("p", 1);
		return "xuanzejiajiaolisttp";
	}
	
	@RequestMapping("deleteXuanzejiajiao.do")
	public String deleteXuanzejiajiao(int id,HttpServletRequest request){
		xuanzejiajiaoService.delete(id);
		String url = request.getHeader("Referer");
		return "redirect:"+url;
		//return "redirect:xuanzejiajiaoList.do";
	}
	
	
}
